const router = require('koa-router')()
router.prefix('/questions/:questionId/answers/:answerId/comments')
const {
    find,
    findById,
    create,
    update,
    deleteComment,
    checkCommentator,
    checkCommentExist
} = require("../controller/comments")
const auth = require("../utils/auth")

// 查询评论列表
router.get("/", find)
// 创建一个评论
router.post("/", auth, create)
// 根据ID查询特定评论
router.get("/:id", checkCommentExist, findById)
// 更新一个评论
router.patch("/:id", auth, checkCommentExist, checkCommentator, update)
// 删除一个评论
router.delete("/:id", auth, checkCommentExist, checkCommentator, deleteComment)


module.exports = router
